/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package controller;

import java.util.List;
import model.Empresa;
import org.hibernate.Session;
import org.hibernate.Transaction;
import util.HibernateUtil;




/**
 *
 * @author crevin
 */
public class EmpresaDAO implements IEmpresaDAO{
        public void save(Empresa empresa) {
        Session session = HibernateUtil.getSessionFactory().openSession();
        Transaction t = session.beginTransaction();
        session.save(empresa);
        t.commit();
    }
        
        /*
    public Empresa getLivro(long id) {
        Session session = DAO.getSessionFactory().openSession();
        return (Empresa) session.load(Empresa.class, id);
    }
    public List<Empresa> list() {
        Session session = DAO.getSessionFactory().openSession();
        Transaction t = session.beginTransaction();
        List lista = session.createQuery("from Livro").list();
        t.commit();
        return lista;
    }
    public void remove(Empresa empresa) {
        Session session = DAO.getSessionFactory().openSession();
        Transaction t = session.beginTransaction();
        session.delete(empresa);
        t.commit();
    }
    public void update(Empresa empresa) {
        Session session = DAO.getSessionFactory().openSession();
        Transaction t = session.beginTransaction();
        session.update(empresa);
        t.commit();
    }
         */

}
